function showPauseFrame(args)
	CEGUI.WindowManager:getSingleton():getWindow("Root/GameBackground/PauseFrame"):setVisible(true)
end

function restartButtonClicked(args)
	--CEGUI.WindowManager:getSingleton():getWindow("Root/GameBackground/PauseFrame"):setVisible(false)
	local ani = aniMgr:instantiateAnimation(aniMgr:getAnimation("loseblood1"))
	ani.setTargetWindow(ani,winMgr:getWindow("Root/GameBackground/Bloods"))
	ani.start(ani)
end

function continuesButtonClicked(args)
	--CEGUI.WindowManager:getSingleton():getWindow("Root/GameBackground/PauseFrame"):setVisible(false)
	local ani = aniMgr:instantiateAnimation(aniMgr:getAnimation("loseblood3"))
	ani.setTargetWindow(ani,winMgr:getWindow("Root/GameBackground/Bloods"))
	ani.start(ani)

end

function backToMainMenuButtonClicked(args)
	PapaBallSceneManager:getSingleton():setScene("MainScene")
end

function highLight4PF(agrs)
	local ani = aniMgr:instantiateAnimation(aniMgr:getAnimation("HighLight"))
	ani.setTargetWindow(ani,winMgr:getWindow("Root/GameBackground/PauseFrame"))
	ani.start(ani)
end

function lowLight4PF(agrs)
	local ani = aniMgr:instantiateAnimation(aniMgr:getAnimation("LowLight"))
	ani.setTargetWindow(ani,winMgr:getWindow("Root/GameBackground/PauseFrame"))
	ani.start(ani)
end

-----------------------------------------
-- Script Entry Point
-----------------------------------------
guiSystem = CEGUI.System:getSingleton()
schemeMgr = CEGUI.SchemeManager:getSingleton()
winMgr = CEGUI.WindowManager:getSingleton()
aniMgr = CEGUI.AnimationManager:getSingleton()

-- load our demo8 scheme
schemeMgr:create("MySkin.scheme");
-- load our demo8 window layouts
local root = winMgr:loadWindowLayout("gameFrame.layout")
-- set the layout as the root
guiSystem:setGUISheet(root)
-- set default mouse cursor
guiSystem:setDefaultMouseCursor("MySkinImages", "MouseArrow")


-- subscribe required events
winMgr:getWindow("Root/GameBackground/OptionButton"):subscribeEvent("Clicked", "showPauseFrame")
winMgr:getWindow("Root/GameBackground/PauseFrame/Restart"):subscribeEvent("Clicked", "restartButtonClicked")
winMgr:getWindow("Root/GameBackground/PauseFrame/Continues"):subscribeEvent("Clicked", "continuesButtonClicked")
winMgr:getWindow("Root/GameBackground/PauseFrame/BackToMainMenu"):subscribeEvent("Clicked", "backToMainMenuButtonClicked")

winMgr:getWindow("Root/GameBackground/PauseFrame"):subscribeEvent("MouseEnter", "highLight4PF");
winMgr:getWindow("Root/GameBackground/PauseFrame"):subscribeEvent("MouseLeave", "lowLight4PF");

MenuManager:getSingleton():Deactive(true)

